{include file="admin/common/header" /}
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label required">博主称呼</label>
                    <div class="layui-input-block ">
                        <input type="text" name="title" autocomplete="off"
                               placeholder="请输入博主称呼"
                               class="layui-input" value="{$data.title}">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label required">开博时间</label>
                    <div class="layui-input-block ">
                        <input type="text" name="create_time" class="layui-input" id="ID-laydate"
                               placeholder="yyyy-MM-dd" value="{$data.create_time}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">个性签名</label>
                <div class="layui-input-block ">
                    <input type="text" name="signature" lay-verify="required" autocomplete="off"
                           placeholder="请输入个性签名"
                           class="layui-input" value="{$data.signature}">
                </div>
            </div>
            <div class="layui-form-item huicmf-upload">
                <label class="layui-form-label">博主头像</label>
                <div class="layui-input-block">
                    <input type="text" name="avatar" value="{$data.avatar}"
                           onmouseover="hui_img_preview('avatar-select-input',this.value)"
                           onmouseout="layer.closeAll();" id="avatar-select-input" autocomplete="off"
                           class="layui-input">
                    <button type="button" class="layui-btn layui-btn-normal layUpload" id="picker_pic2"
                            data-multiple="false" data-input-id="avatar-select-input"
                            data-preview-id="avatar" data-type="image"><i class="layui-icon"></i>上传图片
                    </button>
                    <a class="layui-btn" style="margin-left: 10px;"
                       data-open-pic="/admin/index/file_list?type=one&select_id=avatar-select-input">
                        <i class="layui-icon">&#xe67c;</i>选择图片
                    </a>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">博客简介</label>
                <div class="layui-input-block ">
                    <textarea class="layui-textarea" name="desc">{$data.desc}</textarea>
                </div>
            </div>

        </div>
    </div>
    <div class="bottom">
        <input type="hidden" name="id" value="{$data.id}">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="admin-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

{include file="admin/common/footer" /}
<script>
  layui.use(['form', 'jquery','laydate','upload_hui'], function () {
    let form = layui.form;
    let $ = layui.jquery;
    let laydate = layui.laydate;
    let upload_hui = layui.upload_hui;
    upload_hui.render();

    laydate.render({
      elem: '#ID-laydate'
    });
    form.render();

    form.on('submit(admin-save)', function (data) {
      $.ajax({
        url: "/app/huiblog/module/config/edit",
        data: JSON.stringify(data.field),
        dataType: 'json',
        contentType: 'application/json',
        type: 'post',
        success: function (res) {
          if (res.code === 200) {
            hui_msg(res.msg, 1, function () {
              window.location.reload();
            });
          } else {
            hui_msg(res.msg, 2);
          }
        }
      })
      return false;
    });
  })
</script>
<script>
</script>
</body>
</html>
